﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Web;
using System.Drawing;
namespace CuaHangBanGiay.Models
{
        public class HinhAnh
        {
            public HinhAnh()
            {
                this.id = 0;
                this.duongdan = "";
            }
            public int id { get; set; }
            public String duongdan { get; set; }//đường dẫn tương đối
        }
        public class SanPham
        {
            public SanPham()
            {
                this.id = 0;
                this.ds_sanpham_tag = new List<ChiTietSP>();
              //  this.ds_dathang = new List<DatHang>();
                this.ds_hinhanh = new List<HinhAnh>();
                this.masp = "";
                this.ten = "";
                this.mota = "";
                this.gia=0;
                this.active = true;
            }
            [Key]
            public int id { get; set; }
            public String masp { get; set; }
            public String ten { get; set; }
            public String mota { get; set; }
            public int gia { get; set; }
            public Boolean active { get; set; }
            //external
            public virtual List<ChiTietSP> ds_sanpham_tag { get; set; }
           // public virtual List<DatHang> ds_dathang { get; set; }
            public virtual List<HinhAnh> ds_hinhanh { get; set; }
            public virtual HangSX hangsx { get; set; }
            public virtual NhomSanPham nhomsanpham { get; set; }
          //  public virtual NhanVien nguoidung { get; set; }
        }
        public class Topic
        {
            public Topic()
            {
                this.id = 0;
                this.ds_phanhoi = new List<PhanHoi>();
                this.ten = "";
                this.noidung = "";
                this.ngay = DateTime.Now;
                this.active = true;
            }
            [Key]
            public int id { get; set; }
            public String ten { get; set; }
            public String noidung { get; set; }
            public DateTime ngay { get; set; }
            public Boolean active { get; set; }
            //external
            //public virtual KhachHang nguoitao { get; set; }
            public virtual List<PhanHoi> ds_phanhoi { get; set; }
        }
        public class PhanHoi
        {
            public PhanHoi()
            {
                this.id = 0;
                this.ten = "";
                this.noidung = "";
                this.ngay = DateTime.Now;
                this.active = true;
            }
            [Key]
            public int id { get; set; }
            public String ten { get; set; }
            public String noidung { get; set; }
            public DateTime ngay { get; set; }
            public Boolean active { get; set; }
            //external
            //public virtual NhanVien nhanvien { get; set; }//Nhân viên gửi
            //public virtual KhachHang khachhang { get; set; }//Khách Hàng gửi
            public virtual Topic topic { get; set; }//thuộc Topic nào
        }
        public class ChiTietSP
        {
            public ChiTietSP()
            {
                this.id = 0;
                this.active = true;
                this.ds_chitiet_donhang = new List<ChiTiet_DonHang>();
                this.ds_chitiet_nhaphang = new List<ChiTiet_NhapHang>();
                this.ds_tonkho = new List<TonKho>();
                this.soluong = 0;
            }
            [Key]
            public int id { get; set; }
            public int soluong { get; set; }
            public Boolean active { get; set; }
            //external
            public virtual List<ChiTiet_DonHang> ds_chitiet_donhang { get; set; }
            public virtual List<ChiTiet_NhapHang> ds_chitiet_nhaphang { get; set; }
            public virtual List<TonKho> ds_tonkho { get; set; }
            public virtual KichThuoc kichthuoc { get; set; }
            public virtual MauSac mausac { get; set; }
            public virtual SanPham sanpham { get; set; }
        }
        public class KichThuoc
        {
            public KichThuoc()
            {
                this.id = 0;
                this.active = true;
                this.ds_sanpham_tag = new List<ChiTietSP>();
                this.giatri = "";
            }
            [Key]
            public int id { get; set; }
            public String giatri { get; set; }
            public Boolean active { get; set; }
            //external
            public virtual List<ChiTietSP> ds_sanpham_tag { get; set; }
        }
        public class MauSac
        {
            public MauSac()
            {
                this.id = 0;
                this.active = true;
                this.ds_sanpham_tag = new List<ChiTietSP>();
                this.giatri = "";
            }
            [Key]
            public int id { get; set; }
            public String giatri { get; set; }
            public Boolean active { get; set; }
            //external
            public virtual List<ChiTietSP> ds_sanpham_tag { get; set; }
        }
        public class HangSX
        {
            public HangSX()
            {
                this.id = 0;
                this.active = true;
                this.ds_sanpham = new List<SanPham>();
                this.tenhsx = "";
            }
            [Key]
            public int id { get; set; }
            public String tenhsx { get; set; }
            public Boolean active { get; set; }
            //external
            public virtual List<SanPham> ds_sanpham { get; set; }
        }
        public class NhomSanPham
        {
            public NhomSanPham()
            {
                this.id = 0;
                this.active = true;
                this.ds_sanpham = new List<SanPham>();
                this.ds_nhomcon = new List<NhomSanPham>();
                this.ten = "";
                this.mota = "";
            }
            [Key]
            public int id { get; set; }
            public String ten { get; set; }
            public String mota { get; set; }
            public Boolean active { get; set; }
            //external
            public virtual NhomSanPham nhomcha { get; set; }
            public virtual List<NhomSanPham> ds_nhomcon { get; set; }
            public virtual List<SanPham> ds_sanpham { get; set; }
        }
        //public class NhaCC
        //{
        //    public NhaCC()
        //    {
        //        this.id = 0;
        //        this.active = true;
        //        this.ds_nhaphang = new List<NhapHang>();
        //        this.ten_ncc = "";
        //        this.diachi_ncc = "";
        //        this.sdt_ncc = "";
        //    }
        //    [Key]
        //    public int id { get; set; }
        //    public String ten_ncc { get; set; }
        //    public String diachi_ncc { get; set; }
        //    public String sdt_ncc { get; set; }
        //    public Boolean active { get; set; }
        //    //external
        //    public virtual List<NhapHang> ds_nhaphang{get;set;}
        //}
        public class HinhAnhkim
        {
            public String hinh_name {get;set;}
            public Image hinh { get; set; }
            public Boolean check { get; set; }
            public HinhAnhkim()
            {
                hinh_name = "";
                check = false;
                
            }
        }
        public class NhapHang
        {
            public NhapHang()
            {
                this.id = 0;
                this.active = true;
                this.ds_chitiet_nhaphang = new List<ChiTiet_NhapHang>();
                this.ngay = DateTime.Now;
                this.tongtien = 0;
                this.thanhtoan = 0;
                this.ten_nhacungcap = "";
                this.ten_nhanvien = "";
            }
            [Key]
            public int id { get; set; }
            public DateTime ngay { get; set; }
            public int tongtien { get; set; }
            public int thanhtoan { get; set; }
            public String ten_nhanvien { get; set; }
            public String ten_nhacungcap { get; set; }
            public Boolean active { get; set; }
            //external
          //  public virtual NhaCC nhacc { get; set; }
            //public virtual NhanVien nhanvien { get; set; }
            public virtual List<ChiTiet_NhapHang> ds_chitiet_nhaphang { get; set; }

        }
        public class ChiTiet_NhapHang
        {
            public ChiTiet_NhapHang()
            {
                this.id = 0;
                this.soluong = 0;
                this.dongia = 0;
            }
            [Key]
            public int id { get; set; }
            public int soluong { get; set; }
            public int dongia { get; set; }
            //external
            public virtual NhapHang nhaphang { get; set; }
            public virtual ChiTietSP sanpham_tag { get; set; }
        }
        public class DonHang
        {
            public DonHang()
            {
                this.id = 0;
                this.active = true;
                this.ds_chitiet_donhang = new List<ChiTiet_DonHang>();
                this.ngay = DateTime.Now;
                this.diachi_nguoinhan = "";
                this.ten_nguoinhan = "";
                this.sdt_nguoinhan = "";
                this.tennv = "";
            }
            [Key]
            public int id { get; set; }
            public DateTime ngay { get; set; }
            public int tongtien { get; set; }
            public Boolean dathanhtoan { get; set; }
            public Boolean dagiaohang { get; set; }
            public String diachi_nguoinhan { get; set; }
            public String ten_nguoinhan { get; set; }
            public String sdt_nguoinhan { get; set; }
            public String tennv { get; set; }
            public Boolean active { get; set; }
            //external
            public virtual List<ChiTiet_DonHang> ds_chitiet_donhang { get; set; }
            //public virtual NhanVien nguoidung { get; set; }
            //public virtual KhachHang khachhang { get; set; }
        }
        public class ChiTiet_DonHang
        {
            public ChiTiet_DonHang()
            {
                this.id = 0;
                this.soluong = 0;
                this.dongia = 0;
            }
            [Key]
            public int id { get; set; }
            public int soluong { get; set; }
            public int dongia { get; set; }
            //external
            public virtual DonHang donhang { get; set; }
            public virtual ChiTietSP sanpham_tag { get; set; }
        }
        //public class KhachHang
        //{
        //    public KhachHang()
        //    {
        //        this.id = 0;
        //        this.active = true;
        //        this.ds_donhang = new List<DonHang>();
        //        this.ds_phanhoi = new List<PhanHoi>();
        //        this.ds_topic = new List<Topic>();
        //        this.tendangnhap = "";
        //        this.tendaydu = "";
        //        this.matkhau = "";
        //        this.diachi = "";
        //        this.email = "";
        //        this.sdt = "";
        //    }
        //    [Key]
        //    public int id { get; set; }
        //    public String tendangnhap { get; set; }
        //    public String tendaydu { get; set; }
        //    public String matkhau { get; set; }
        //    public String diachi { get; set; }
        //    public String email { get; set; }
        //    public String sdt { get; set; }
        //    public Boolean active { get; set; }
        //    //external
        //    public virtual List<DonHang> ds_donhang { get; set; }
        //    public virtual List<PhanHoi> ds_phanhoi { get; set; }
        //    public virtual List<Topic> ds_topic { get; set; }
        //}
        //public class NhanVien
        //{
        //    public NhanVien()
        //    {
        //        this.id = 0;
        //        this.active = true;
        //       // this.group_id = 0;
        //       // this.ds_sanpham = new List<SanPham>();
        //        this.ds_donhang = new List<DonHang>();
        //        this.ds_nhaphang= new List<NhapHang>();
        //        this.ds_phanhoi = new List<PhanHoi>();
        //        this.tendangnhap = "";
        //        this.tendaydu = "";
        //        this.email = "";
        //        this.matkhau = "";
        //    }
        //    [Key]
        //    public int id { get; set; }
        //    public String tendangnhap { get; set; }
        //    public String tendaydu { get; set; }
        //    public String email { get; set; }
        //    public String matkhau { get; set; }
        //    public Boolean active { get; set; }
        //  //  public int group_id { get; set; }//0: Admin, 1: Normal user, 2: Guest
        //    //external
        //    //public virtual List<SanPham> ds_sanpham { get; set; }
        //    public virtual List<DonHang> ds_donhang { get; set; }
        //    public virtual List<NhapHang> ds_nhaphang{get;set;}
        //    public virtual NhomNhanVien nhomnhanvien { get; set; }
        //    public virtual List<PhanHoi> ds_phanhoi { get; set; }
        //}
        //public class NhomNhanVien
        //{
        //    public NhomNhanVien()
        //    {
        //        this.id = 0;
        //        this.tennhom = "";
        //        this.ds_nhanvien = new List<NhanVien>();
        //    }
        //    [Key]
        //    public int id { get; set; }
        //    public String tennhom { get; set; }
        //    //external
        //    public virtual List<NhanVien> ds_nhanvien { get; set; }
        //    public virtual List<PhanQuyen> ds_phanquyen { get; set; }
            
        //}
        //public class PhanQuyen
        //{
        //    public PhanQuyen()
        //    {
        //        this.id = 0;
        //        this.tenquyen = "";
        //        this.ds_nhomnhanvien = new List<NhomNhanVien>();
        //    }
        //    public int id { get; set; }
        //    public String tenquyen { get; set; }
        //    //external
        //    public virtual List<NhomNhanVien> ds_nhomnhanvien { get; set; }
        //}
        public class TonKho
        {
            public TonKho()
            {
                this.id = 0;
                this.ngay = DateTime.Now;
                this.soluongton = 0;
            }
            [Key]
            public int id { get; set; }
            public DateTime ngay { get; set; }
            public int soluongton { get; set; }
            //external
            public virtual ChiTietSP sanpham_tag { get; set; }
        }
        //public class ChiPhiVC
        //{
        //    public ChiPhiVC()
        //    {
        //        this.id = 0;
        //        this.tentinh = "";
        //        this.chiphivc = 0;
        //    }
        //    public int id { get; set; }
        //    public String tentinh { get; set; }
        //    public int chiphivc { get; set; }
        //}
        public class CuaHangBanGiayDBContext : DbContext
        {  
            public DbSet<DonHang> ds_donhang { get; set; }
            public DbSet<ChiTiet_DonHang> ds_chitiet_donhang { get; set; }
            public DbSet<SanPham> ds_sanpham { get; set; }
            public DbSet<ChiTietSP> ds_sanpham_tag { get; set; }
            public DbSet<MauSac> ds_mausac { get; set; }
            public DbSet<KichThuoc> ds_kichthuoc { get; set; }
            public DbSet<HangSX> ds_hangsx { get; set; }
            public DbSet<NhomSanPham> ds_nhomsanpham { get; set; }
            public DbSet<HinhAnh> ds_hinhanh { get; set; }
            //public DbSet<KhachHang> ds_khachhang { get; set; }
            //public DbSet<NhanVien> ds_nhanvien { get; set; }
            public DbSet<ChiTiet_NhapHang> ds_chitiet_nhaphang { get; set; }
            public DbSet<NhapHang> ds_nhaphang { get; set; }
           // public DbSet<NhaCC> ds_nhacc { get; set; } 
            public DbSet<TonKho> ds_tonkho { get; set; }
            //public DbSet<NhomNhanVien> ds_nhomnhanvien { get; set; }
            //public DbSet<PhanQuyen> ds_phanquyen { get; set; }
            //public DbSet<ChiPhiVC> ds_chiphivc { get; set; }
        }
}